/**
 * 
 */

var bt_guest_book_input, bt_guest_book_del, bt_guest_book_gomian;

function guest_book_init() {
	general();
	
}

function general() {

	
	bt_guest_book_gomain = document.getElementById('bt_guest_book_gomain');
	if(bt_guest_book_gomain != null){
		bt_guest_book_gomain.onclick = function(){
		var frm_gomain = document.hidden_guest_book_frm;
		frm_gomain.action = "index.jsp"; 
		frm_gomain.submit();
		}
	}
	
	bt_guest_book_input = document.getElementById('bt_guest_book_input');
	if(bt_guest_book_input != null){
		bt_guest_book_input.onclick = function(){
			var frm_input = document.hidden_guest_book_frm;
			var text = document.getElementById("tf_guest_book_input");
			var mmid = document.hidden_guest_book_frm.m_id.value;
			if(mmid != "null")
			{
				if(text.value != "")
				{
					alert("방명록 입력 성공.");
					frm_input.g_text.value = text.value;
					frm_input.action = "index.jsp?page_set=./guest_book/guest_book_input.jsp";
					frm_input.submit();
				}
				else
				{
					alert("내용이 없습니다. 내용을 입력해주세요.");
				}
			}
			else 
			{
				alert("로그인이 필요합니다.");
			}	
			
		}
	}
	
	if(tf_guest_book_input != null){
		tf_guest_book_input.onkeydown = function(){
			var frm_tf = document.hidden_guest_book_frm;
			var text = document.getElementById("tf_guest_book_input");
			var mmid = document.hidden_guest_book_frm.m_id.value;
			if(event.keyCode == 13)
			{	
				if(mmid != "null")
				{
					if(text.value != "")
					{
						alert("방명록 입력 성공.");
						frm_tf.g_text.value = text.value;
						frm_tf.action = "index.jsp?page_set=./guest_book/guest_book_input.jsp";
						frm_tf.submit();
					}
					else
					{
						alert("내용이 없습니다. 내용을 입력해주세요.");
					}
				}
				else 
				{
					alert("로그인이 필요합니다.");
				}	
			}
		}
	}
}

function day_check_init() {
	general();
	if(document.getElementById('bt_guest_book_cc') != null){
		document.getElementById('bt_guest_book_cc').onclick = function()
		{
			alert("출석 성공!");
//			location.href = "day_check.jsp?inc=./day_check.jsp"
			
			
		}
	}
	
	
}	
	
function goPage(page)
{
	
	var mf = document.hidden_guest_book_frm;
	mf.now_page.value = page;
	mf.action = "index.jsp?page_set=./guest_book.jsp";
	mf.submit();
}

function guest_book_del(g_rno)
{
	var b = confirm("정말 삭제하시겠습니까?");
	var mf = document.del_del;
	if(b)
	{
		alert("삭제를 성공하였습니다.");
		mf.g_rno.value = g_rno;
		mf.submit();
	}else{
		alert("삭제가 취소되었습니다.");
	}
		
	
}

